{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style >
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px
    }

    #title span {
        float: right;
    }

    .asdlkjasd {
        background: #1ab394;
        color: #fff
    }

    td {
        word-wrap: break-word;
        word-break: break-all;
        max-width: 700px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
            {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar loadClick">
                        <!--<a class="btn btn-default btn-outline {eq name='type' value='1'}asdlkjasd{/eq}"  href="{:url('records',['type'=>'1'])}">今日记录</a>-->
                        <a class="btn btn-default btn-outline {eq name='type' value='2'}asdlkjasd{/eq}"  href="{:url('records',['type'=>'2'])}">展开全部</a>
                        <a class="btn btn-default btn-outline {eq name='type' value='8'}asdlkjasd{/eq}"  href="{:url('records',['type'=>'8'])}">非招呼记录</a>
                        <!--<a class="btn btn-default btn-outline {eq name='type' value='-1'}asdlkjasd{/eq}" href="{:url('records',['type'=>'-1'])}">最新记录</a>-->
                        <!--<a class="btn btn-default btn-outline {eq name='type' value='4'}asdlkjasd{/eq}"  href="{:url('records',['type'=>'4'])}">男用户与客服的对话</a>-->
                        <!--<a style="margin-left:30px" class="btn btn-default btn-outline {eq name='type' value='6'}asdlkjasd{/eq}"  href="{:url('records',['type'=>'6'])}">仅对方可见</a>-->
                        <!--<a class="btn btn-default btn-outline {eq name='type' value='7'}asdlkjasd{/eq}"  href="{:url('records',['type'=>'7'])}">对方不可见</a>-->
                        <!-- <a class="btn btn-default btn-outline {eq name='type' value='5'}asdlkjasd{/eq}"  href="{:url('records',['type'=>'5'])}">虚拟用户</a> -->
                        <a style="margin-left:100px" class="btn btn-default btn-outline {present name='types'}{else /}asdlkjasd{/present}" href="{:url('records')}">所有</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='1'}asdlkjasd{/eq}"  href="{:url('records',['types'=>'1'])}{present name='type'}/type/{$type}{/present}">图片</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='2'}asdlkjasd{/eq}"  href="{:url('records',['types'=>'2'])}{present name='type'}/type/{$type}{/present}">语音</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='3'}asdlkjasd{/eq}"  href="{:url('records',['types'=>'3'])}{present name='type'}/type/{$type}{/present}">打招呼图片</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='4'}asdlkjasd{/eq}"  href="{:url('records',['types'=>'4'])}{present name='type'}/type/{$type}{/present}">含数字或字母</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='5'}asdlkjasd{/eq}"  href="{:url('records',['types'=>'5'])}{present name='type'}/type/{$type}{/present}">已撤回消息</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='6'}asdlkjasd{/eq}"  href="{:url('records',['types'=>'6'])}{present name='type'}/type/{$type}{/present}">通话</a>
                    </div>
                    <div style="display:block;clear: both;"></div>
                    <div class="fixed-table-toolbar">
                        <form  method="get" action="" style="display: flex;">
                            <div class="pull-left search" style="display: flex;">
                                <div class="columns columns-right btn-group pull-left">
                                    <select class="form-control" name="search">
                                        <option value="userid" {php}if(input('?param.search')){if(input('param.search')=='userid'){echo "selected";} }{/php}>用户ID</option>
                                        <option value="content" {php}if(input('?param.search')){if(input('param.search')=='content'){echo "selected";} }{/php}>内容</option>
                                        <option value="touserid" {php}if(input('?param.search')){if(input('param.search')=='touserid'){echo "selected";} }{/php}>接收方用户ID</option>
                                        <option value="id" {php}if(input('?param.search')){if(input('param.search')=='id'){echo "selected";} }{/php}>消息ID</option>
                                    </select>
                                </div>

                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text"
                                           {php}
                                           if(input('?param.name')){
                                    if(input('param.name')){
                                    echo "value='".input('name')."'";
                                    }

                                    }
                                    {/php}
                                    name="name" placeholder="输入双方ID，用,隔开">
                                </div>

                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit" id="search-btn">搜索</button>
                                </div>

                                <input name="start" type="text" id="start" class="form-control layui-input" value="{present name='start'}{$start}{/present}" placeholder=" # 起始时间" autocomplete="off" style="height:34px;width:180px;margin:0 10px;">
                                <input name="end" type="text" id="end" class="form-control layui-input" value="{present name='end'}{$end}{/present}" placeholder=" # 结束时间" autocomplete="off" style="height:34px;width:180px;margin:0 10px;">

                                {php}
                                if(input('?param.name')){
                                {/php}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-link" href="{:url('records')}">返回列表</a>
                                </div>{php}
                                }
                                {/php}
                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                        <table data-toggle="table">
                            <thead>
                            <tr>
                                <th class="bs-checkbox"><input type="checkbox" id="delidAll"></th>
                                <th data-align="center">ID</th>
                                <th data-align="center">发送方</th>
                                <!--<th data-align="center">    </th>-->
                                <th data-align="center">接收方</th>
                                <th>内容</th>
                                <th data-align="center">金币</th>
                                <th data-align="center">积分</th>
                                <th data-align="center">收益状态</th>
                                <!--<th data-align="center">类型</th>-->
                                <!--<th data-align="center">是否为客服消息</th>-->
                                <th data-align="center">时间</th>
                                <th data-align="center">管理</th>
                            </tr>
                            </thead>
                            <tbody id="form">
                                {php}
                                $riskUsers = db('user_risk')->where(['end_time'=>0])->column('user_id');
                                $selectUsers = db('select_users')->column('user_id');
                                {/php}
                            {volist name="data" id="v"}
                            <tr id="id{$v.id}" class="class">
                                <td id="delid" ><input name="delAll[]" type="checkbox" value="{$v.id}"></td>
                                <td>{$v.id}</td>
                                <td>
                                    {php}
                                    $userinfo = _user_cache($v['userid'], 'name,is_banned,sex');
                                    {/php}
                                    <a onClick="add('{:url('member/index',['search'=>'id','name'=>$v['userid']])}')" style="color:#40BCF7">{$userinfo['name']} {$userinfo['is_banned']?'<span style="color: red;">(已封号)</span>':''}{:in_array($v['userid'], $riskUsers)?'<span style="color: red;">(风控)</span>':''}{:in_array($v['userid'], $selectUsers)?'<span style="color: red;">(精选)</span>':''}</a><br > ({$v.userid})({$userinfo['sex']})
                                </td>
                                <!--<td>>>>></td>-->
                                <td>
                                    {php}
                                    $touserinfo = _user_cache($v['touserid'], 'name,is_banned,sex');
                                    {/php}
                                    <a onClick="add('{:url('member/index',['search'=>'id','name'=>$v['touserid']])}')" style="color:#40BCF7">{$touserinfo['name']} {$touserinfo['is_banned']?'<span style="color: red;">(已封号)</span>':''}{:in_array($v['touserid'], $riskUsers)?'<span style="color: red;">(风控)</span>':''}</a> <br > ({$v.touserid})({$touserinfo['sex']})
                                </td>
                                <td>
                                    {switch name="$v.type"}
                                        {case value="-1"}<span style="color:#490">{eq name="v.status" value="3"}[消息已撤回]{else}[提示]{/eq}</span>
                                        {php}
                                            if(strpos($v['content'],'/disk/uploads')!==false){
                                                if(strpos($v['content'],'.mp3')!==false){
                                        {/php}
                                            <audio src="{:strpos($v.content, 'http')===false?'__ROOT__':''}{$v.content}" controls="controls">Your browser does not support the audio element.</audio>
                                        {php}
                                                } else {
                                        {/php}
                                            <a href="{present name='$v.content'}{:strpos($v.content, 'http')===false?'__ROOT__':''}{$v.content}{/present}" target="_blank">
                                                <img src="{present name='$v.content'}{:strpos($v.content, 'http')===false?'__ROOT__':''}{$v.content}{else /}__IMG__add_img.png{/present}" id="imageimg" style="max-width: 100px;max-height: 600px">
                                            </a>
                                        {php}
                                                }
                                            } else {
                                        {/php}
                                        {:biaoqing($v.content)}
                                        {php}
                                            }
                                        {/php}
                                        {/case}
                                        {case value="1"}
                                        <a href="{present name='$v.content'}{:strpos($v.content, 'http')===false?'__ROOT__':''}{$v.content}{/present}" target="_blank" onclick="lookBigImg('{present name='$v.content'}{:strpos($v.content, 'http')===false?'__ROOT__':''}{$v.content}{else /}__IMG__add_img.png{/present}')">
                                                <img src="{present name='$v.content'}{:strpos($v.content, 'http')===false?'__ROOT__':''}{$v.content}{else /}__IMG__add_img.png{/present}" id="imageimg" style="max-width: 100px;max-height: 600px">
                                            </a>
                                        {/case}
                                        {case value="2"}
                                        <audio src="{:strpos($v.content, 'http')===false?'__ROOT__':''}{$v.content}" controls="controls">Your browser does not support the audio element.</audio>

                                        {php}echo $v['is_fate'] ? '<span style="color:#490">[招呼语]</span>' : '';
                                        {/php}

                                        {/case}
                                        {case value="5"}[红包] {:biaoqing($v.content)}{/case}
                                        {case value="9"}
                                        [语音通话] 
                                        {php}
                                            $jsondata = json_decode($v['data'], true);
                                            echo isset($jsondata['end']) && isset($jsondata['start']) ? $jsondata['end'] - $jsondata['start'] : 0;
                                        {/php}秒 
                                        {php}echo isset($jsondata['hpr']) ? ' 异常挂断原因'.$jsondata['hpr'] : '';
                                        {/php}
                                        <div style="color:skyblue; cursor: pointer;" onclick='showLianmaiDetail({php}echo $v['data'];{/php})'>
                                            通话详情
                                        </div>
                                        {/case}
                                        {case value="10"}
                                        [视频通话] 
                                        {php}
                                            $jsondata = json_decode($v['data'], true);
                                            echo isset($jsondata['end']) && isset($jsondata['start']) ? $jsondata['end'] - $jsondata['start'] : 0;
                                        {/php}秒 
                                        {php}echo isset($jsondata['hpr']) ? ' 异常挂断原因'.$jsondata['hpr'] : '';
                                        {/php}
                                        <div style="color:skyblue; cursor: pointer;" onclick='showLianmaiDetail({php}echo $v['data'];{/php})'>
                                            通话详情
                                        </div>
                                        {/case}
                                        {case value="11"}
                                        {php}
                                            if (strpos($v['data'], '{') === 0) {
                                                $biaoqing_data = json_decode($v['data'], true)['value']??0;
                                            } else {
                                                $biaoqing_data = $v['data'];
                                            }
                                        {/php}
                                        {if condition="$biaoqing_data"}
                                        [自定义表情包]
                                            <a href="{present name='$v.content'}{:strpos($v.content, 'http')===false?'__ROOT__':''}{$v.content}{/present}" target="_blank">
                                                <img src="{present name='$v.content'}{:strpos($v.content, 'http')===false?'__ROOT__':''}{$v.content}{else /}__IMG__add_img.png{/present}" id="imageimg" style="max-width: 100%;max-height: 600px">
                                            </a>
                                        {else}
                                        [系统内置表情包] {$v.content}
                                        {/if}
                                        {/case}
                                        {default /}{:biaoqing($v.content)}
                                    {/switch}

                                    {php}
                                    if ($v['single'] == 1) {
                                        echo '<span style="color:#f40">[仅对方可见]</span>';
                                    } else if ($v['single'] == 2) {
                                        echo '<span style="color:#f40">[对方不可见]</span>';
                                    }
                                    {/php}
                                    {php}
                                    if ($v['userid'] == $kefu) {
                                        if ($v['isRead']) {
                                            echo '<span style="color:#1ab394">[已读]</span>';
                                        } else {
                                            echo '<span style="color:#8aa">[未读]</span>';
                                        }
                                    }
                                    {/php}
                                    {php}
                                    if ($v['status'] == 4) {
                                        echo '<span style="color:#f40">[双方删除]</span>';
                                    }
                                    {/php}
                                </td>
                                <!--<td>{switch name="$v.k"}
                                    {case value="0"}否{/case}
                                    {case value="1"}是{/case}
                                    {default /}消息类型有误
                                {/switch}</td>-->
                                <td>{$v.money}</td>
                                <td>{$v.score}</td>
                                <td>
                                    {if condition='$v.score > 0'}
                                        {eq name='$v.finish' value='0'}
                                            <span style="color:red">待领取</span>
                                        {else /}
                                            <span style="color:#1ab394">结束</span>
                                        {/eq}
                                    {/if}
                                </td>
                                <td>{$v.addtime}</td>
                                    <td>
                                        {eq name='d' value='0'}
                                        <a onclick="chat('{$v.userid},{$v.touserid}')" style="color:#40BCF7">查看对话</a>
                                        <br />
                                        {/eq}
                                    <div class="btn-group">
                                        <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">操作 <span class="caret"></span>
                                        </div>
                                        <ul class="dropdown-menu">
                                            {present name='ids'}
                                            <?php
                                                    if (in_array($v['userid'], $ids)){
                                                        $user_id = $v['userid'];
                                                        $touserid = $v['touserid'];
                                                    } else {
                                                        $user_id = $v['touserid'];
                                                        $touserid = $v['userid'];
                                                    }
                                                ?>
                                            <li><a href="{:url('kefu/screen',['userid'=>$user_id,'touserid'=>$touserid,'url'=>-1])}" target="_blank">回复</a></li>
                                            {else /}
                                            <li><a href="{:url('kefu/screen',['userid'=>$v['userid'],'touserid'=>$v['touserid'],'url'=>-1])}" target="_blank">发送方回复</a></li>
                                            <li><a href="{:url('kefu/screen',['userid'=>$v['touserid'],'touserid'=>$v['userid'],'url'=>-1])}" target="_blank">接收方回复</a></li>
                                            {/present}
                                            <li><a onClick="del({$v.id})">删除单条</a></li>
                                            <li><a onClick="delalls({$v.id})">删除双方所有消息</a></li>
                                            <li><a onClick="delalls({$v.id}, 1)">删除双方所有消息并初始化聊天</a></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-6">
                    <div  class="btn btn-outline btn-default" onclick="alla('del')">
                        批量删除
                    </div>
                    <div  class="btn btn-outline btn-default" onclick="exportData()">
                        批量导出
                    </div>
                    <div  class="btn btn-outline btn-default" onclick="exportData(1)">
                        批量导出系统招呼
                    </div>
                    <div  class="btn btn-outline btn-default" onclick="exportData(2)">
                        批量导出手动批量招呼
                    </div>
                </div>
                <div class="col-sm-12 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
<div id="LianmaiDetail" style="text-align:center;display:none;margin: 0px 30px;padding:10px 100px">
</div>
<div id="OrderDetail" style="text-align:center;display:none;margin: 0px 30px;padding:10px 100px">
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $('#delidAll').click(function(){
            $('input[type=checkbox]').each(function(){
                var self=$(this);
                if(!self.prop('checked')){
                    self.prop('checked',true);
                }else{
                    self.prop('checked',false);
                }
            });
        })
    });
    var formatDateString = (date) => {
      const year = date.getFullYear();
      const month = String(date.getMonth() + 1).padStart(2, "0");
      const day = String(date.getDate()).padStart(2, "0");
      return `${year}-${month}-${day}`;
    };

    var nowTime=new Date();
    var lastday = new Date() //当天
        lastday.setMonth(lastday.getMonth()-6)//三个月前，时间戳
    var tomorrow = new Date() //当天
    tomorrow.setDate(tomorrow.getDate() + 1);


    layui.use(['laydate'], function(){
        var laydate = layui.laydate;

        laydate.render({
            elem: '#start' //指定元素
            ,type: 'datetime'
            ,trigger: 'click',
            max:'nowTime',//默认最大值为当前日期
            min:formatDateString(lastday)
        });

        laydate.render({
            elem: '#end' //指定元素
            ,type: 'datetime'
            ,trigger: 'click',
            max:formatDateString(tomorrow),
            min:formatDateString(lastday)
        });
    })


    function del(id){
        swal_del(id,"{:url('pdel')}")
    }
    function delalls(id, reset = 0){
        swal_delAll({id},"{:url('delalls')}?reset=" + reset, 1)
    }

    function alla(){
        return newAllDel()

        var all = $(".form-horizontal").serialize();

        ajaxFun("post",'{:url("delAll")}',all,'json',function(ret){
            if(ret){
                swal_msg('操作成功')
                window.location.reload();
            }
        })
    }
    function newAllDel() {
        const alls = $(".form-horizontal").serializeArray();
        const idsToDelete = alls.map(item => item.value);

        // 使用 Promise.all 来处理所有 AJAX 请求
        Promise.all(idsToDelete.map(id => deleteById(id)))
            .then(results => {
                const delLen = results.filter(result => result).length;
                swal_msg(`已删除${delLen}条`, '', '', 1);
            })
            .catch(error => {
                console.error('删除过程中发生错误:', error);
                swal_msg('删除过程中发生错误，请重试。', '', '', 1);
            });
    }

    function deleteById(id) {
        return new Promise((resolve, reject) => {
            $.ajax({
                type: 'POST',
                url: "{:url('admin/usertalk/pdel')}",
                data: { id: id },
                dataType: 'json',
                success: function (data) {
                    resolve(data.ret);
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    console.error('请求失败:', textStatus, errorThrown);
                    reject(textStatus);
                }
            });
        });
    }

    var downing = false
    function exportData(sys_fate = 0) {
        if(downing){
            return layer.msg('导出进程较慢，请勿频繁点击');
        }
        downing = true
        setTimeout(()=>{
            downing = false
        }, 10000)
        
        var url = "<?php echo $_SERVER['REQUEST_URI']; ?>";
        var all = $(".form-horizontal").serialize();

        // if(!all){
        //     layer.msg("请选择需要导出的项！")
        //     return false
        // }

        var type = "{$type}";
        var types = "{$types}";
        var search = "{$search_type}";
        var name = "{$search_name}";
        window.location.href = '{:url("export/privatechat")}?' + all + '&url=' + url + '&type=' + type + '&types=' + types + '&name=' + name + '&search=' + search + '&sys_fate=' + sys_fate;
    }

/* 将时间戳格式化为yyyy-MM-dd hh:mm:ss格式，其它格式可自行更改 */
function formatTimeMills(timeMills){
    var date = new Date(timeMills);
    var timeStr = '';
    timeStr += date.getHours() < 10 ? ('0' + date.getHours()) : date.getHours();
    timeStr += ':';
    timeStr += date.getMinutes() < 10 ? ('0' + date.getMinutes()) : date.getMinutes();
    timeStr += ':';
    timeStr += date.getSeconds() < 10 ? ('0' + date.getSeconds()) : date.getSeconds();
    return timeStr;
}
    function showLianmaiDetail(orderData) {
        // console.log(orderData)
        let html = ''
        if (orderData.end && orderData.end > orderData.start) {
            html += `<div class="form-control">计费开始时间：<span style="font-weight:bold;">${formatTimeMills(orderData.start*1000)}</span></div>`
            html += `<div class="form-control">计费结束时间：<span style="font-weight:bold;">${formatTimeMills(orderData.end*1000)}</span></div>`
            html += `<div class="form-control">通话时长：<span style="font-weight:bold;">${orderData.end - orderData.start}秒</span></div>`
        } else {
            html += `<div class="form-control">通话时长：<span style="font-weight:bold;">0秒</span></div>`
        }
        html += `<div class="form-control">订单ID：<span style="font-weight:bold;">${orderData.orderid}</span><span onclick="getOrderInfo(${orderData.orderid})" style="color:#f60;">查看订单数据</span></div>`
        html += `<div class="form-control">支付用户：<span style="font-weight:bold;">${orderData.payer}</span></div>`
        if (orderData.hpr) {
            html += `<div class="form-control">异常挂断原因：<span style="font-weight:bold;">${orderData.hpr}</span></div>`
        } else if (orderData.hpu) {
            html += `<div class="form-control">挂断用户：<span style="font-weight:bold;">${orderData.hpu}</span></div>`
        }

        for (let key in orderData.pending) {
            html += `<hr />`
            html += `<div >用户：${key}通话过程</div>`
            for (let i = 0; i < orderData.pending[key].length; i++) {
                html += `<div class="form-control">${formatTimeMills(orderData.pending[key][i].t * 1000)} ${orderData.pending[key][i].s==0?'挂入后台':'拉起前台'}</div>`
            }
        }
        if (orderData.socket) {
            html += `<hr />`
            html += `<div >续签日志</div>`
            for (let i = 0; i < orderData.socket.length; i++) {
                html += `<div class="form-control">${formatTimeMills(orderData.socket[i].t * 1000)} 用户${orderData.socket[i].u} ${orderData.socket[i].s==0?'续签失效':'续签'}</div>`
            }
        }
        $('#LianmaiDetail').html(html)
        var index = layer.open({
            area: ['540px', '500px'],
            type: 1,
            title: '通话详情',
            content: $('#LianmaiDetail'),
            btn: ['确定'],
            yes: function (index, layero) {
                layer.close(index);
            }
        })
    }

    function getOrderInfo(id) {
        $.ajax({
            type: 'POST',
            url: "{:url('admin/usertalk/orderInfo')}",
            data: {id},
            dataType: 'json',
            success: function (data) {
                if (data.state) {
                    showOrderDetail(data.data)
                } else {
                    layer.msg(data.msg, {icon: 0});
                }
            },
            error: function (e) {
                layer.msg(e.responseText);
            }
        });
    }
    function showOrderDetail(orderData) {
        let html = ''
        if (orderData.end && orderData.end > orderData.start) {
            html += `<div class="form-control">计费开始时间：<span style="font-weight:bold;">${formatTimeMills(orderData.start*1000)}</span></div>`
            html += `<div class="form-control">计费结束时间：<span style="font-weight:bold;">${formatTimeMills(orderData.end*1000)}</span></div>`
            html += `<div class="form-control">通话时长：<span style="font-weight:bold;">${orderData.end - orderData.start}秒</span></div>`
            html += `<div class="form-control">计费时长：<span style="font-weight:bold;">${orderData.duration}分钟</div>`
        } else {
            html += `<div class="form-control">通话时长：<span style="font-weight:bold;">0秒</span></div>`
        }
        html += `<div class="form-control">单价：<span style="font-weight:bold;">${orderData.price}</span></div>`
        if (orderData.duration) {
            html += `<div class="form-control">扣费金币：<span style="font-weight:bold;">${orderData.money}</span></div>`
            html += `<div class="form-control">产生积分：<span style="font-weight:bold;">${orderData.score}</span></div>`
        }
        html += `<div class="form-control">首次扣费秒数：<span style="font-weight:bold;">${orderData.first_second}</span></div>`
        html += `<div class="form-control">支付方IP：<span style="font-weight:bold;">${orderData.ip}</span></div>`
        html += `<div class="form-control">是否私密通话：<span style="font-weight:bold;">${orderData.privacy?'是':'否'}</span></div>`
        html += `<div class="form-control">对方ID：<span style="font-weight:bold;">${orderData.another_id}</span></div>`

        $('#OrderDetail').html(html)
        var index = layer.open({
            area: ['500px', '500px'],
            type: 1,
            title: '订单原始数据',
            content: $('#OrderDetail'),
            btn: ['确定'],
            yes: function (index, layero) {
                layer.close(index);
            }
        })
    }
    function chat(uids)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("usertalk/records")}?search=userid&d=1&name='+uids
            });
        });
    }
</script>
{include file="public/footer" /}

